#ifndef PLUGININTERFACE_H
#define PLUGININTERFACE_H

#include <QObject>
#include <QJsonObject>

struct PluginMetaData
{
    QString from;   //消息来源
    QString dest;   //消息去向
    QString msg;    //消息

    QObject* object = nullptr;
    QJsonObject info = QJsonObject();
};
Q_DECLARE_METATYPE(PluginMetaData); //确保类型可以通过信号槽传递

//定义接口
class PluginInterface
{
public:
    virtual ~PluginInterface(){}
    virtual void recMsgFromManager(PluginMetaData) = 0; //接收来自插件管理器的消息
    virtual void sendMsgToManager(PluginMetaData) = 0;  //发生消息到插件管理器
};

//一定是唯一的标识符
#define PluginInterface_iid "Examples.Plugin.PluginInterface"

QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(PluginInterface,PluginInterface_iid)
QT_END_NAMESPACE

#endif // PLUGININTERFACE_H
